'use strict';
module.exports = () =>
  async function statusRespose(ctx, next) {
    await next();
    if (ctx.body) {
      ctx.body.status &&
        +ctx.body.status >= 200 &&
        (ctx.status = ctx.body.status) &&
        delete ctx.body.status;
    } else {
      ctx.body = {
        msg: '接口不存在，请按照resfulApi规范请求接口',
      };
      ctx.status = 404;
    }
  };
